using System;
using System.Web;
using System.Web.Security;
using MRGSP.SurveyMaster.Core.Security;

namespace MRGSP.SurveyMaster.WebUI
{
    public class FormAuths : IFormsAuthentication
    {
        public void SignIn(string userName, bool createPersistentCookie, string role)
        {
            var authTicket = new FormsAuthenticationTicket(
              1,
              userName,  //user id
              DateTime.Now,
              DateTime.Now.AddMinutes(20),  // expiry
              createPersistentCookie,
              role,
              "/");

            var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(authTicket));

            HttpContext.Current.Response.Cookies.Add(cookie);
            //FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
        }
        public void SignOut()
        {
            FormsAuthentication.SignOut();
        }
    }
}